package com.code.socket1;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.Socket;

/**
 * @description:
 * @className: ClientSocket
 * @package: com.code.socket
 * @author: yangzhi@hsyuntai.com
 * @date: 2019/10/15 15:51
 * @copyright: 版权归 HSYUNTAI 所有
 */
public class ClientSocket {

    public static void main(String args[]) {
        String host = "127.0.0.1";
        int port = 8919;
        try {
            Socket client = new Socket(host, port);
            Writer writer = new OutputStreamWriter(client.getOutputStream());
            writer.write("Hello From Client777777");
            writer.flush();
            writer.close();
            client.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
